package com.fy.service.imbusiness.controller;


import com.fy.service.service.SkImFeedbackService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fy.framework.common.model.R;
import com.fy.framework.component.config.LocaleMessage;
import com.fy.common.entity.SkImFeedback;
import com.fy.common.util.TokenUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zhshuo
 * @date 2021/12/01 16:30
 **/
@Slf4j
@RestController
@AllArgsConstructor
@Api(tags = "系统反馈")
@RequestMapping("/system/feedback")
public class SkImFeedbackController {

    LocaleMessage localeMessage;

    SkImFeedbackService feedbackService;

    /**
     * 用户意见反馈提交
     * @param skimfeedback 意见反馈
     * @return {@link R}
     */
    @PostMapping
    @ApiOperation("提交用户反馈")
    public R<?> post(@RequestBody SkImFeedback skimfeedback) {
        boolean insert = feedbackService.insert(skimfeedback.setSkImUserId(TokenUtil.getUserId()));
        return insert ? R.successAlter(localeMessage.getMessage("im.common.commitSuccess"))
                :R.failedAlter(localeMessage.getMessage("im.common.failedful"));
    }

    @PostMapping("page")
    // @ApiOperation("分页查询用户反馈")
    public R<?> page() {
        // TODO
        return null;
    }
}
